// @flow
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
import { TurboModuleRegistry } from 'react-native';

/// NoteAPI Module 
export interface Spec extends TurboModule {

  /**
   * Insert image
   * @param {string} imgPath 
   * 
   * Return data format:
   * {
   * success: boolean, whether insertion was successful
   * errorCode: 101 - empty path, 102 - image parsing error, 103 - image size exceeds 2560x2560
   * errorMsg: string
   * }
   */
  insertNoteImage(imgPath: string): Promise<?Object>;

  /**
   * Modify image data
   * @param {*} imageData 
   * Data structure:
   * {
   *   path: string - path of image to modify
   *   rect: { // Image display area data, same type as getNoteImageRect return type
   *   left: x-coordinate of top-left vertex
   *   top: y-coordinate of top-left vertex
   *   right: x-coordinate of bottom-right vertex
   *   bottom: y-coordinate of bottom-right vertex
   *   }
   * }
   * Return data format:
   * {
   * success: boolean, whether modification was successful
   * errorCode: 101 - empty path, 102 - image parsing error, 103 - image size exceeds 2560x2560
   * errorMsg: string
   * }
   */
  modifyNoteImage(imageData:Object):Promise<?Object>;

  /**
   * Get current editing image information
   * Data structure:
   * {
   *  path: image path
   *  width: image width
   *  height: image height
   *  rect: { // Image display area data, same type as getNoteImageRect return type
   *    left: x-coordinate of top-left vertex
   *    top: y-coordinate of top-left vertex
   *    right: x-coordinate of bottom-right vertex
   *    bottom: y-coordinate of bottom-right vertex
   *  }
   * }
   */
  getCurrentNoteImageInfo():Promise<?Object>;

  /**
   * Get current image lasso selection area range
   * Returns rect with parameters:
   * {
   *  left: x-coordinate of top-left vertex
   *  top: y-coordinate of top-left vertex
   *  right: x-coordinate of bottom-right vertex
   *  bottom: y-coordinate of bottom-right vertex
   * }
   * 
   */
  getCurrentNoteImageLassoRect():Promise<?Object>;

  getPenInfo(): Promise<Object>;

  setPenInfo(penInfo: Object): Promise<boolean>;

  getLayers(): Promise<string>;

  setLayers(layers: string): Promise<boolean>;

  /// Get data
  getData(key: string): Promise<string>;

  /// Save data
  saveData(key: string, value: string): Promise<boolean>;

  /// Get all data
  getAllData(): Promise<Object>;

  normalize(text: string): Promise<string>;
  setFullAuto(enable: boolean): void;




}
export default (TurboModuleRegistry.get < Spec > (
  'NativeNoteAPI'
):?Spec);